package com.openthree.common.oss;

import com.qcloud.cos.COSClient;
import com.qcloud.cos.ClientConfig;
import com.qcloud.cos.sign.Credentials;

import java.io.IOException;
import java.io.InputStream;

/**
 * 腾讯云存储
 * @author mhj
 * @email 254784163@qq.com
 * @date 2017-03-26 20:51
 */
public class QcloudCloudStorageService extends CloudStorageService{
    private COSClient client;

    public QcloudCloudStorageService(CloudStorageConfig config){
        this.config = config;

        //初始化
        init();
    }

    private void init(){
    	Credentials credentials = new Credentials(config.getQcloudAppId(), config.getQcloudSecretId(),
                config.getQcloudSecretKey());

    	//初始化客户端配置
        ClientConfig clientConfig = new ClientConfig();
        //设置bucket所在的区域，华南：gz 华北：tj 华东：sh
        clientConfig.setRegion(config.getQcloudRegion());

    	client = new COSClient(clientConfig, credentials);
    }

    @Override
    public String getPath(String prefix) {
        return super.getPath(prefix);
    }

    @Override
    public String uploadObjectByInputStream(InputStream inputStream, String folder, String fileName) {
        return null;
    }

    @Override
    public String uploadObjectByInputStream(InputStream inputStream, String fileFullPath) {
        return null;
    }

    @Override
    public byte[] getFileByteByKey(String fileKey) {
        return new byte[0];
    }

    @Override
    public InputStream getFileInputStreamByKey(String key) {
        return null;
    }

    @Override
    public String getFileUrl(String ossFileKey, int expires) {
        return null;
    }

    @Override
    public String getSltFileUrl(String ossFileKey, String centerName) throws IOException {
        return null;
    }

    @Override
    public byte[] toByteArray(InputStream input) throws Exception {
        return super.toByteArray(input);
    }
}
